#!/usr/bin/env bash

#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#

set -e

LOCAL_VERSION=$(cargo metadata --no-deps --format-version 1 | jq --raw-output -c '.packages[] | select(.name == "s2n-quic").version')
CRATES_IO_VERSION=$(cargo search "s2n-quic" --limit 1 | head -n 1 | cut -d'"' -f2)

# Exits with 0 if the local version has not been published to crates.io yet, otherwise exits with 1
[[ "$LOCAL_VERSION" != "$CRATES_IO_VERSION" ]]
